package Demo_01;

public class Thread_01 {
    Thread thread = new Thread(() -> {
        System.out.println("线程启动...");
    });

    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            System.out.println("我的名字：" + Thread.currentThread().getName());
        });
        System.out.println(thread.getName() + "Id:" + thread.getId());
        System.out.println(thread.getName() + "状态:" + thread.getState());
        System.out.println(thread.getName() + "优先级:" + thread.getPriority());
        System.out.println(thread.getName() + "后台线程:" + thread.isDaemon());
        System.out.println(thread.getName() + "活着:" + thread.isAlive());
        System.out.println(thread.getName() + "被中断:" + thread.isInterrupted());
        thread.start();
        //执行后
        System.out.println("------------");
        System.out.println(thread.getName() + "后台线程:" + thread.isDaemon());
        System.out.println(thread.getName() + "活着:" + thread.isAlive());
        System.out.println(thread.getName() + "被中断:" + thread.isInterrupted());
    }
    public static void main1(String[] args) {
        for (Thread.State state : Thread.State.values()) {
            System.out.println(state);
        }
    }
}
